<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header">

</head>
<body class="hold-transition skin-blue sidebar-mini">
<style>
    .table-border tbody tr td{
        border-top: 1px solid black;
    }
</style>
<section class="content-header">
    <h1>
        合同登记查询
    </h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm" onsubmit="return false;">
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group" style="margin-right: 10px;">
                                    <label>项目编号</label>
                                    <input type="text" name="contName" class="form-control" placeholder="项目编号" >
                                </div>
                                <div class="form-group" style="margin-right: 10px;">
                                    <label>买方</label>
                                    <input type="text" name="consumerName" class="form-control" placeholder="买方名称">
                                </div>
                                <div class="form-group" style="margin-right: 10px;">
                                    <label>买方合同编号</label>
                                    <input type="text" name="buyCode" class="form-control" placeholder="买方合同编号">
                                </div>
                                <div class="form-group" style="margin-right: 10px;">
                                    <label>卖方合同编号</label>
                                    <input type="text" name="sellCode" class="form-control" placeholder="卖方合同编号">
                                </div>
                                <div class="form-group" style="margin-right: 10px;margin-top: 5px;">
                                    <label>类别</label>
                                    <select class="form-control" name="contType" >
                                        <option value="">全部</option>
                                        <option value="对外销售">对外销售</option>
                                        <option value="对内销售">对内销售</option>
                                        <option value="合作制造">合作制造</option>
                                    </select>
                                </div>

                                <div class="form-group" style="margin-right: 10px;margin-top: 5px;">
                                    <label>任务状态</label>
                                    <select name="isStatue" class="form-control" style="width:200px;">
                                        <option  value="0" selected="selected">全部</option>
                                        <option  value="-1">未开始</option>
                                        <option  value="1">待提交</option>
                                        <option  value="3">待组级审</option>
                                        <option  value="4">待科级审</option>
                                        <option  value="6">待部级审</option>
                                        <option  value="30">已完成</option>
                                    </select>
                                </div>

                                <button type="button" class="btn btn-success" id="btn-search" style="margin-top: 5px;">
                                    <!--<i class="fa fa-search"></i>-->
                                    <span class="Bold">搜索</span>
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="box-body">
                    <table id="bootstrap-table" class="table-border" style="table-layout: fixed;word-break:break-all; word-wrap:break-word;"></table>
                </div>
            </div>
        </div>
    </div>
</section>

<div th:include="include :: footer">
</div>
<script th:inline="javascript">
    /** 加载用户表格 */
    table = js.table.init({
        url: ctx + "contractManage/selAllContract",
        showColumns: false,
        showExport: false,
        pageSize:100,
        columns: [
            {
                title: '序号', field: 'id', width: '50',
                formatter: function (value, row, index, field) {
                    var pageSize = table.bootstrapTable('getOptions').pageSize;
                    var pageNumber = table.bootstrapTable('getOptions').pageNumber;
                    return pageSize * (pageNumber - 1) + index + 1;
                }
            },
            { title: "项目编号", field: 'code'},
            { title: "包含项目", field: 'contName'},
            // { title: "报价单编号", field: 'quoteNo'},
            { title: "买方名称", field: 'consumerName'},
            { title: "卖方名称", field: 'supplierName'},
            { title: "执行人", field: 'createName'},
            { title: "合同类别", field: 'contType'},
            { title: "买方合同编号", field: 'buyCode'},
            { title: "卖方合同编号", field: 'sellCode'},
            // { title: "创建时间", field: 'quoteGentDate'},
            { title: "任务状态", field: 'isStatue',
                formatter: function (value, row, index) {
                    if(value==3){
                        return '<span class="label  badge  label-success">已完成</span>';
                    }else if(value==2){
                        return '<span class="label  badge  label-warning">'+row.isStatueName+'</span>';
                    }else if (value==4) {
                        return '<span class="label  badge  label-danger">被驳回</span>';
                    }else if (value==1) {
                        return '<span class="label  badge  label-info">'+row.isStatueName+'</span>';
                    }else{
                        return '<span class="label  badge  label-default">'+row.isStatueName+'</span>';
                    }
                }
            },

            {
                title: "操作",
                width: '110',
                formatter: function (value, row, index) {
                    var actions = [];
                   if(row.isStatue==3){
                    actions.push('<a class="btn btn-info btn-xs" href="'+ ctx + 'contractManage/lookContract?quoteId=' + row.quoteId + '&conId=' + row.id + '&parentId=' + row.parentId + '"> 查看</a> ');
                   }
                    return actions.join('');
                }
            }
        ]
    });
    /**
     * 表格搜索
     */
    $("#btn-search").click(function () {
        js.table.search(table);
    });


</script>